1. Field of the Invention
The present invention relates to image processing for adjusting gradation of image data and to an image processing method for a digital image and a computer program for enhancing contrast of an input image.
2. Description of the Related Art
A contrast of a digital image is enhanced by plotting a histogram (gradation distribution) of luminance or three primary colors (RGB) included in inputted image data (referred to as an “input image”) and correcting the histogram. Known histogram correction methods include equalization and extension.
It is known that, for example, a digital image having an overall whitish, foggy appearance due to excessive light quantity as a result of exposure time or the like (in the present specification, referred to as a “fog image”) or a digital image conversely having an overall blackish, dark appearance due to insufficient light quantity can be adjusted to a clear image with enhanced contrast by plotting a histogram of luminance values of an input image and subjecting the histogram to equalization or extension to correct the luminance values of the input image to appropriate values (for example, refer to Japanese Patent Laid-Open No. S63-040471, Japanese Patent Laid-Open No. 2006-191401, and Japanese Patent Laid-Open No. 2007-292804).
However, an image processing method based on a histogram is problematic in that uniform averaging and extension of gradations of an input image inadvertently corrects regions whose contrast is sufficient in the first place.
In other words, when regions whose contrast is sufficient in the first place and regions whose contrast is conversely insufficient are unevenly distributed in an input image, performing uniform correction using a histogram for the entire input image may cause a pixel with high gradation to affect a region surrounding the pixel. As a result, insufficient contrasts may remain locally even after image processing, or minute but important images may become inconspicuous as a result of image processing.
The present invention has been made in consideration of the above, and an object of the present invention is to provide an image processing method and a computer program capable of adjustment to an appropriate contrast and, in particular, capable of obtaining an output image with an enhanced contour even when various contrasts are included in an input image in an uneven distribution.